package aidn.animation.controller 
{
	import aidn.animation.transition.Mosaic;
	import flash.display.MovieClip;
	import flash.events.Event;
	
	/**
	 * Timeline
	 */
	public class TimelineClipManager 
	{
		private var _target :MovieClip;
		private var _view   :MovieClip;
		
		public function TimelineClipManager ( ) 
		{
			
		}
		
		/**
		 * 
		 * @param	target	Timeline上に MC 設置したクリップ(非表示)。
		 * @param	view	target　上の MC が配置されるクリップ。
		 */
		public function init ( target :MovieClip, view :MovieClip ) :void
		{
			_target = target;
			_target.addEventListener(Event.ENTER_FRAME, _enterFrame);
			_target.visible = false;
			
			_view = view;
		}
		
		private function _enterFrame ( evt :Event ) :void 
		{
			var i :int;
			var n :int = _target.numChildren;
			
			for (i = 0; i < n; i ++)
			{
				var m :MovieClip = _target.getChildAt(0) as MovieClip;
				if (m)
				{
					_target.removeChildAt(0);
					_view.addChild(m);
					
					/*
					m.visible = false;
					var mosaic :Mosaic = new Mosaic();
					mosaic.init(m);
					*/
				}
			}
			
		}
	}
}